<template><div><h2 id="laravel-octane" tabindex="-1"><a class="header-anchor" href="#laravel-octane"><span>Laravel Octane</span></a></h2>
<p><a href="https://github.com/laravel/octane" target="_blank" rel="noopener noreferrer">Laravel Octane</a> 是一个基于 <code v-pre>Swoole/RoadRunner</code> 驱动的可以提升 <code v-pre>Laravel</code> 框架性能的项目，安装后可以大幅提升<code v-pre>Laravel</code>项目的性能。</p>
<p><code v-pre>Dcat Admin</code>从<code v-pre>v2.0.23-beta</code>版本起兼容了<code v-pre>Laravel Octane</code>环境，只需在配置文件<code v-pre>config/octane.php</code>中加入如下配置即可：</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line"></span>
<span class="line">    <span class="token string single-quoted-string">'listeners'</span> <span class="token operator">=></span> <span class="token punctuation">[</span></span>
<span class="line">        <span class="token operator">...</span><span class="token punctuation">,</span></span>
<span class="line"></span>
<span class="line">        <span class="token class-name static-context">RequestReceived</span><span class="token operator">::</span><span class="token keyword">class</span> <span class="token operator">=></span> <span class="token punctuation">[</span></span>
<span class="line">            <span class="token operator">...</span><span class="token class-name static-context">Octane</span><span class="token operator">::</span><span class="token function">prepareApplicationForNextOperation</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">,</span></span>
<span class="line">            <span class="token operator">...</span><span class="token class-name static-context">Octane</span><span class="token operator">::</span><span class="token function">prepareApplicationForNextRequest</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">,</span></span>
<span class="line"></span>
<span class="line">            <span class="token comment">// 开启对 Dcat Admin 的支持</span></span>
<span class="line">            <span class="token class-name class-name-fully-qualified static-context">Dcat<span class="token punctuation">\</span>Admin<span class="token punctuation">\</span>Octane<span class="token punctuation">\</span>Listeners<span class="token punctuation">\</span>FlushAdminState</span><span class="token operator">::</span><span class="token keyword">class</span><span class="token punctuation">,</span></span>
<span class="line">        <span class="token punctuation">]</span><span class="token punctuation">,</span></span>
<span class="line"></span>
<span class="line">        <span class="token operator">...</span></span>
<span class="line">    <span class="token punctuation">]</span><span class="token punctuation">,</span>    </span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><blockquote>
<p><a href="https://github.com/laravel/octane" target="_blank" rel="noopener noreferrer">Laravel Octane</a>目前仍处于<code v-pre>beta</code>版本阶段，关于<a href="https://github.com/laravel/octane" target="_blank" rel="noopener noreferrer">Laravel Octane</a>的安装与更多介绍请前往文档 <a href="https://github.com/laravel/octane" target="_blank" rel="noopener noreferrer">github.com/laravel/octane</a> 查看。</p>
</blockquote>
<p>本文章首发在 <a href="https://learnku.com/" target="_blank" rel="noopener noreferrer">LearnKu.com</a> 网站上。</p>
</div></template>


